import request from "@/utils/request";
import { ProjectRegType } from "@/api/account/project/types";
import { encryptSM3 } from "@/utils/";

/**
 * 项目管理员注册
 *
 * @param data
 */
export function projectADReg(data: ProjectRegType) {
  return request({
    url: "/api/v1/account/manager_register",
    method: "post",
    data: data,
  });
}

/**
 * 手机获取验证码
 *
 * @param data
 */
export function getVerificationCode(phone: string) {
  return request({
    url: "/api/v1/account/verificationcode",
    method: "get",
    params: { phone },
  });
}

/**
 * new_项目管理员注册
 *
 * @param data
 */
export function new_projectADReg(params, data) {
  params.password = encryptSM3(params.password);
  return request({
    url: "/api/v1/account/manager_register",
    method: "post",
    params: params,
    data: data,
  });
}

/**
 * 获取项目注册表单
 *
 * @param projectId
 */
export function get_register_form(projectId: number) {
  return request({
    url: `/api/v1/account/register_form/${projectId}/`,
    method: "get",
  });
}
